package com.weetop.akly.utils.widget;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.weetop.akly.R;


/**
 * Created by yzhya on 2018/10/15.
 */

public class EmptyView extends RelativeLayout {

    private ImageView iv_empty_view;
    private TextView tv_title1;
    private TextView tv_title2;


    public EmptyView(Context context) {
        super(context);
    }

    public EmptyView(Context context, AttributeSet attrs) {
        super(context, attrs);
        LayoutInflater.from(context).inflate(R.layout.empty_view_show, this, true);
        iv_empty_view = ((ImageView) findViewById(R.id.iv_empty_view));
        tv_title1 = ((TextView) findViewById(R.id.tv_title1));
        tv_title2 = ((TextView) findViewById(R.id.tv_title2));


    }

    public void show() {
        setVisibility(VISIBLE);
    }

    public void show(String text) {
        setVisibility(VISIBLE);
        tv_title1.setText(text);
    }


    public void hide() {
        setVisibility(GONE);
    }

    public void setInfo(String title1, int drawable) {
        tv_title1.setText(title1);
        iv_empty_view.setImageResource(drawable);
    }

    public void setInfo(String title1, int drawable, String color) {
        tv_title1.setText(title1);
        tv_title1.setTextColor(Color.parseColor(color));
        tv_title1.setVisibility(VISIBLE);
        iv_empty_view.setImageResource(drawable);
    }

    public void setInfo(String title1, String title2, int drawable) {
        tv_title1.setText(title1);
        tv_title2.setText(title2);
        iv_empty_view.setImageResource(drawable);
    }


}
